package com.ljx.demo.security.core;

import org.springframework.security.core.Authentication;

/**
 * @Author: LiJunXi
 * @Description:
 * @Date: 2024-06-17  09:54
 */
public class UserHolder {
    private static final ThreadLocal<Authentication> contextHolder = new ThreadLocal<>();

    public static Authentication getContext()
    {
        return contextHolder.get();
    }

    public static void setContext(Authentication context)
    {
        contextHolder.set(context);
    }

    public static void clearContext()
    {
        contextHolder.remove();
    }
}
